<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateImageobjObjetoTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('imageobj_objeto', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('imageobj_id')->unsigned()->index();
			$table->foreign('imageobj_id')->references('id')->on('imageobjs')->onDelete('cascade');
			$table->integer('objeto_id')->unsigned()->index();
			$table->foreign('objeto_id')->references('id')->on('objetos')->onDelete('cascade');
                        $table->tinyinteger('position')->unsigned();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::dropIfExists('imagerel_objeto');
	}

}
